package gui.tool;

import SqlConnect.SqlInvestment;

import javax.swing.*;
import javax.swing.table.DefaultTableModel;
import java.awt.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Vector;

public class STable extends JPanel {
    public STable(String title, Vector<Vector<String>> resource, Vector<String> head) {
        super(new BorderLayout());
        add(new JLabel(title, JLabel.CENTER), BorderLayout.NORTH);
        JTable table = new JTable(new DefaultTableModel(resource, head));
        JScrollPane scrollPane = new JScrollPane(table);
        add(scrollPane, BorderLayout.CENTER);
    }

    public STable(String title, Vector<Vector<String>> resource) {
        this(title, resource, new Vector<>(new ArrayList<>(Arrays.asList(SqlInvestment.guiTag))));
    }
}
